package QL;

import java.util.List;
import java.util.ArrayList;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

public class ButlerRealGoodsOrderGetListResponse extends BaseQLResponse
{
    /// <summary>
    /// 实物奖励兑换订单列表
    /// </summary>
    public List<ButlerRealGoodsOrderInfo> InfoList;

    /// <summary>
    /// 总共页数
    /// </summary>
    public long TotalCount;

    @Override
    public void DeserializeFromJson(JSONObject jsonObj)
    {
        JSONObject t = jsonObj.getJSONObject("error_response");
        if (t != null && !t.isNullObject())
        {
            ErrCode = t.getString("code");
            ErrMsg = t.getString("msg");
        }
        else
        {
            t = jsonObj.getJSONObject("butler_real_goods_order_get_list_response");
            InfoList = new ArrayList<ButlerRealGoodsOrderInfo>();
            JSONArray arrInfoList = t.getJSONObject("info_list").getJSONArray("butler_real_goods_order_info");
            for (int i = 0; i < arrInfoList.size(); ++i)
            {
                ButlerRealGoodsOrderInfo o = new ButlerRealGoodsOrderInfo();
                o.DeserializeFromJson(arrInfoList.getJSONObject(i));
                InfoList.add(o);
            }
            if (t.has("total_count"))
                TotalCount = t.getLong("total_count");
        }
    }
}
